/*
 * YamlParser.cpp
 *
 *  Created on: 03/09/2012
 *      Author: Cynthia
 */
#include "YamlParser.h"
#include "yaml-cpp/emitter.h"
#include "yaml-cpp/node.h"

YamlParser::YamlParser(std::string filename){

	configurationFile.open(filename.c_str(), std::ios_base::in);

	parser = new YAML::Parser(configurationFile);
}

YamlParser::~YamlParser(){
	configurationFile.close();
	delete parser;
}

void YamlParser::parse(){
	YAML::Node doc;

	try{
		while(parser->GetNextDocument(doc)){
			YAML::Emitter emitter;
			emitter << doc;
			std::cout << emitter.c_str() << "\n";
		}
	} catch(const YAML::Exception& e) {
		std::cout << e.what() << std::endl;
	}
}


